#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<stdlib.h>
void selectsort(int* arr, int len);
int main() {
	int arr[] = { 2,6,8,3,7,1,4,21,56,9,10 };
	int len = sizeof(arr) / sizeof(arr[0]);
	selectsort(arr, len);

	for (int i = 0; i < len; i++) {
		printf("%d ", arr[i]);
	}
	return 0;
}


void selectsort(int *arr, int len) {
	int i = 0, j = 0;
	for (i = 0; i < len; i++) {
		int key = i;
		for (j = i+1; j < len; j++) {
			if (arr[key] > arr[j])
				key = j;
		}

		int tmp = arr[i];
		arr[i] = arr[key];
		arr[key] = tmp;
	}

}

